package com.my.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.my.dao.DAO;
import com.my.dao.impl.DAOImpl;

public class AppController {
	
	DAO dao = new DAOImpl();
	
	public void index(HttpServletRequest request, HttpServletResponse response) {
		System.out.println("AppController.index()");
		String hql = "select a.name, a.url from RoleAuth ra join ra.role r join ra.application a join r.users u where a.parent is null and ra.visibility = 1 and u.id = 1";
		List<Object> list = dao.queryByHQL(hql);
		for(Object o: list) {
			Object[] obj = (Object[]) o;
			System.out.println(obj[0] + "-" + obj[1]);
		}
		
	}
	
	public static void main(String[] args) {
		new AppController().index(null, null);
	}

}
